 <template>
    <div>
    <el-input v-model="a" style="width: 40%"/>
    <el-button @click="info()">查询</el-button><br>
    <!-- <el-button @click="up=true">新增</el-button> -->
    <el-table :data="tableData" style="width: 100%"> 
      <el-table-column
        fixed
        prop="physicalTime"
        label="体检时间">
      </el-table-column>
      <el-table-column
        prop="vipid"
        label="档案号">
      </el-table-column>
      <el-table-column
        prop="vipname"
        label="姓名">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="手机号">
      </el-table-column>
      <el-table-column
        prop="packages"
        label="检测套餐">
      </el-table-column>
      <el-table-column
        prop="state"
        label="报告状态">
      </el-table-column>  
      <el-table-column
        fixed="right"
        label="操作">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row.vipid),up=true"  >文件上传</el-button>
          <el-button @click="delphy(scope.row.vipid)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
     <!--分页组件-->
     <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[2, 4, ]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
     <!--拟态框-->
     <el-dialog title="新增" :visible.sync="up">
      <el-tabs v-model="activeName" @tab-click="handleClick">
    <el-tab-pane label="基本信息" name="first">
      <el-form :model="vip">
        <el-upload
        action="/tomcat/upload"
        ref="upload"
        name="pictureFile"
        multiple
        :on-success="upsuccess"
        list-type="picture-card"
        :auto-upload="false"
        :data="this.vip"
      >
        <i slot="default" class="el-icon-plus"></i>
        <div slot="file" slot-scope="{ file }">
          <img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
          <span class="el-upload-list__item-actions">
            <span
              class="el-upload-list__item-preview"
              @click="handlePictureCardPreview(file)"
            >
              <i class="el-icon-zoom-in"></i>
            </span>
            <span
              v-if="!disabled"
              class="el-upload-list__item-delete"
              @click="handleDownload(file)"
            >
              <i class="el-icon-download"></i>
            </span>
            <span
              v-if="!disabled"
              class="el-upload-list__item-delete"
              @click="handleRemove(file, this)"
            >
              <i class="el-icon-delete"></i>
            </span>
          </span>
        </div>
      </el-upload>
      <br /> 
      <el-button
        style="margin-left: 10px"
        size="small"
        type="success"
        @click="submitUpload"
        >上传到服务器</el-button
      >
      <el-dialog :visible.sync="dialogVisible">
        <img width="100%" :src="dialogImageUrl" alt="" />
      </el-dialog>
  <el-button @click="addvip()">确定</el-button>
   </el-form>
</el-tab-pane>
</el-tabs>
</el-dialog>
    </div>
 </template>
 
 <script>


 export default {
    data() {
        return {
          up:false,
          tableData:[],
          vip:{
            vipid: "",
            vipname: "",
            vipsex: "",
            management: "",
            phone:"",
            enrollTime: "",
        },
        a:"",
        b:"",
        c:"",
        activeName: 'first',
         //每页条数
         pageSize:3, 
        //总页数
        total:50,
        //当前页
        currentPage4: 1,
        dialogImageUrl: "",
        dialogVisible: false,
        disabled: false,
        isok: 0,
        num: ""
 }
 },
 methods:{
  //上传
  upsuccess(response, file) {
        this.$notify({
          title: '成功',
          message: file.name + '上传成功！',
          type: 'success',
        });
      },
      submitUpload() {
        this.$refs.upload.submit();
      },
      handleRemove(file) {
        this.$refs.upload.handleRemove(file)
      },
      handlePictureCardPreview(file) {
        this.dialogImageUrl = file.url;
        this.dialogVisible = true;
      },
      handleDownload(file) {
        console.log(file);
      },
    





  handleClick(id) {
    console.log(id)
              this.vip.vipid=id
      },
    // phycx(){
    //     this.axios.post("/tomcat/sele",{vipname:""}).then(data=>{
    //         this.tableData=data.data
    //     })
    // },
    delphy(id){
      this.axios.post("/tomcat/del",{vipid:id}).then(data=>{
        this.vip=data.data
        if(data.data>0){
          alert("删除成功")
          this.info()
        }
      })
    },
        //分页方法
        handleSizeChange(val) {
        this.pageSize=val;
        this.info()
      },
      handleCurrentChange(val) {
        this.currentPage4=val;
        this.info()
      },
      info(){
        this.axios.post("/tomcat/info",{page:this.currentPage4,num:this.pageSize,v:{vipname:this.a}}).then(data=>
        {
          this.total= data.data.total
     this.tableData=data.data.rows
        })
      },
 },
 created () {
   
        this.info();
    
 }
 }
 </script>
 
 <style>
 
 </style>